package com.atguigu.service.impl;

import com.atguigu.dao.FoodDao;
import com.atguigu.dao.impl.FoodDaoImpl;
import com.atguigu.pojo.Food;
import com.atguigu.service.FoodService;

import java.util.List;

public class FoodServiceImpl implements FoodService {
    private FoodDao foodDao = new FoodDaoImpl();

    @Override
    public void addFood(Food food) {
        foodDao.addFood(food);
    }

    @Override
    public void deleteFoodById(Integer id) {
        foodDao.deleteFoodById(id);
    }

    @Override
    public void updateFood(Food food) {
        foodDao.updateFood(food);
    }

    @Override
    public Food queryFoodById(Integer id) {
        return foodDao.queryFoodById(id);
    }

    @Override
    public List<Food> queryFoods() {
        return foodDao.queryFoods();
    }

    @Override
    public List<Food> queryLimitFoods(Integer page, Integer size) {
        return foodDao.queryLimitFoods(page, size);
    }

    @Override
    public List<Food> queryLimitClassFoods(Integer food_id, Integer page, Integer size) {
        return foodDao.queryLimitClassFoods(food_id, page, size);
    }

    @Override
    public long getCount() {
        return foodDao.getCount();
    }

    @Override
    public long getClassCount(Integer food_id) {
        return foodDao.getClassCount(food_id);
    }

    @Override
    public List<Food> queryPriceFoods(Integer min, Integer max, Integer page, Integer size) {
        return foodDao.queryPriceFoods(min, max, page, size);
    }

    @Override
    public List<Food> queryPriceCount(Integer min, Integer max) {
        return foodDao.queryPriceCount(min, max);
    }

    @Override
    public List<Food> queryPriceClassFoods(Integer food_id, Integer min, Integer max, Integer page, Integer size) {
        return foodDao.queryPriceClassFoods(food_id, min, max, page, size);
    }

    @Override
    public List<Food> queryPriceClassCount(Integer food_id, Integer min, Integer max) {
        return foodDao.queryPriceClassCount(food_id, min, max);
    }

    @Override
    public Integer getPriceFoodCount(Integer min, Integer max) {
        return foodDao.queryPriceCount(min, max).size();
    }
}
